<template>
  <div>
    <h1>二维码</h1>
    <canvas id="q"></canvas>
  </div>
</template>

<script>
export default {
  mounted() {
    var canvas = document.getElementById("q");
    console.log("1111111：{}",canvas)
    var $this = this;
    this.axios({
      method: "post",
      url: "http://localhost:9999/system/alibaba/pay/createPayOrder",
      params: {
        access_token: localStorage.getItem("access_token"),
        orderNo: new Date().getTime()
      }
    }).then(function(res) {
        console.log("生成支付宝扫码二维码返回信息为{}",res);
       $this.QRCode.toCanvas(
        canvas,
        res.data.obj,
        function(error) {
          if (error) {
            console.error(error);
          }
          console.log("QRCode success!");
        }
      );
    });
  }
};
</script>